package com.tentact.servlets;


import com.tentact.service.MeetingService;
import com.tentact.vo.MeetingRoom;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;

@WebServlet(name = "addMeetingRoomServlet", value = "/addMeetingRoomServlet")
public class addMeetingRoomServlet extends HttpServlet {

    MeetingService service = new MeetingService();
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        int roomid = 1;
       String roomcode = request.getParameter("roomcode");
       String roomname = request.getParameter("roomname");
       int roomcapacity = Integer.parseInt(request.getParameter("roomcapacity"));
       int status = Integer.parseInt(request.getParameter("status"));
       String description = request.getParameter("description");
        System.out.println(roomcode);
        System.out.println(roomname);
        System.out.println(roomcapacity);
        System.out.println(status);
        System.out.println(description);
        service.insertMeeting(new MeetingRoom(roomid,roomcode,roomname,roomcapacity,status,description));
        request.getRequestDispatcher("SelectMeetingRoomsServlet").forward(request,response);
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        request.setCharacterEncoding("utf-8");
        doGet(request,response);
    }
}
